package com.t282.crm.service;

import com.t282.crm.entity.User;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;
import java.util.List;

@SpringBootTest
@RunWith(SpringRunner.class)
public class UserServiceTester {
    @Resource
    private UserService userService;

    @Test
    public void testCacheable(){
        User user = userService.getUser(2L);
        System.out.println("user.usrName:" + user.getUsrName());
    }

    @Test
    public void testCachePut(){
        User user = new User();
        user.setUsrName("1");
        user.setUsrPassword("1");
        user.setUsrFlag(1);
        userService.addUser(user);
    }

    @Test
    public void testCacheEvict(){
       /* userService.deleteUser(44L);*/
        User user = new User();
        user.setUsrId(45L);
        user.setUsrName("2");
        user.setUsrPassword("1");
        user.setUsrFlag(1);
        userService.updateUser(user);
    }
}
